package com.zc.im.mapper.im.group;

import com.zc.im.model.im.group.ZcImGroup;
import com.zc.im.model.im.group.ZcImGroupExample;
import com.zc.im.model.im.group.ZcImGroupKey;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface ZcImGroupMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_group
     *
     * @mbggenerated
     */
    int countByExample(ZcImGroupExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_group
     *
     * @mbggenerated
     */
    int deleteByExample(ZcImGroupExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_group
     *
     * @mbggenerated
     */
    @Delete({
        "delete from zc_im_group",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(ZcImGroupKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_group
     *
     * @mbggenerated
     */
    @Insert({
        "insert into zc_im_group (id, obj_id, ",
        "type, group_name, ",
        "created_time, updated_time, ",
        "admin_user_id, status)",
        "values (#{id,jdbcType=INTEGER}, #{objId,jdbcType=INTEGER}, ",
        "#{type,jdbcType=VARCHAR}, #{groupName,jdbcType=VARCHAR}, ",
        "#{createdTime,jdbcType=TIMESTAMP}, #{updatedTime,jdbcType=TIMESTAMP}, ",
        "#{adminUserId,jdbcType=INTEGER}, #{status,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=true, resultType=Integer.class)
    int insert(ZcImGroup record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_group
     *
     * @mbggenerated
     */
    int insertSelective(ZcImGroup record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_group
     *
     * @mbggenerated
     */
    List<ZcImGroup> selectByExample(ZcImGroupExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_group
     *
     * @mbggenerated
     */
    @Select({
        "select",
        "id, obj_id, type, group_name, created_time, updated_time, admin_user_id, status",
        "from zc_im_group",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    ZcImGroup selectByPrimaryKey(ZcImGroupKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_group
     *
     * @mbggenerated
     */
    int updateByExampleSelective(@Param("record") ZcImGroup record, @Param("example") ZcImGroupExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_group
     *
     * @mbggenerated
     */
    int updateByExample(@Param("record") ZcImGroup record, @Param("example") ZcImGroupExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_group
     *
     * @mbggenerated
     */
    int updateByPrimaryKeySelective(ZcImGroup record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_im_group
     *
     * @mbggenerated
     */
    @Update({
        "update zc_im_group",
        "set obj_id = #{objId,jdbcType=INTEGER},",
          "type = #{type,jdbcType=VARCHAR},",
          "group_name = #{groupName,jdbcType=VARCHAR},",
          "created_time = #{createdTime,jdbcType=TIMESTAMP},",
          "updated_time = #{updatedTime,jdbcType=TIMESTAMP},",
          "admin_user_id = #{adminUserId,jdbcType=INTEGER},",
          "status = #{status,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(ZcImGroup record);
}